﻿using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using EasyXaf.DynamicForm;

namespace EasyXaf.Sample.Module.BusinessObjects;

[NavigationItem("动态表单")]
public class DynamicFormDemo : BaseObject
{
    [XafDisplayName("动态表单")]
    [Size(SizeAttribute.Unlimited)]
    [EditorAlias("DynamicFormEditor")]
    [DynamicFormSchemaProperty(nameof(Schema))]
    public string Data
    {
        get => GetPropertyValue<string>(nameof(Data));
        set => SetPropertyValue(nameof(Data), value);
    }

    [XafDisplayName("表单定义")]
    [Size(SizeAttribute.Unlimited)]
    public string Schema
    {
        get => GetPropertyValue<string>(nameof(Schema));
        set => SetPropertyValue(nameof(Schema), value);
    }

    [XafDisplayName("表单数据")]
    [Size(SizeAttribute.Unlimited)]
    public string DataCopy
    {
        get => Data;
        set => Data = value;
    }

    public DynamicFormDemo(Session session)
        : base(session)
    {
    }
}
